package com.itheima.d1_method;

import java.util.Random;

/*方法的定义注意事项
1.方法与方法之间属于平级关系.不能嵌套
2.return 值:把数据返回给了调用者.并结束方法
*/
public class Test42 {
    public static void main(String[] args) {

        int[] re = qw();
        for (int i = 0; i < re.length; i++) {
            System.out.println(re[i]);
        }


    }

    public static int cc(int v, int d) {
        int max = 0;
        for (int i = v; i <= d; i++) {
            max += i;
        }
        return max;
    }

    public static int[] qw() {
        int[] a = new int[5];
        Random random = new Random();
        for (int i = 0; i < a.length; i++) {
            a[i] = random.nextInt(100) + 1;
            for (int k = 0; k < i; k++) {
                if (a[k] == a[i]) {
                    i--;
                    break;
                }
            }
        }
        return a;
    }

    public static int cc1(int[] a) {

        int max = a[0];
        for (int i = 0; i < a.length - 1; i++) {
            if (a[i] > max) {
                max = a[i];
            }
        }
        return max;
    }


}
